﻿using Heroius.Extension;
using Heroius.Extension.WPF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace IEPI.BIATranscribe
{
    /// <summary>
    /// ConfigWindow.xaml 的交互逻辑
    /// </summary>
    public partial class ConfigWindow : Window
    {
        public ConfigWindow()
        {
            InitializeComponent();

            Dictionary<string, PropertyPanelAttribute> dictA = new Dictionary<string, PropertyPanelAttribute>();
            dictA.Add("PageHeight", new PropertyPanelAttribute() { Label = "背景表格高度", MatchKey = "a", Order = 0 });
            dictA.Add("PageWidth", new PropertyPanelAttribute() { Label = "背景表格宽度", MatchKey = "a", Order = 1 });
            dictA.Add("CamDist", new PropertyPanelAttribute() { Label = "视点距离", MatchKey = "a", Order = 2, ToolTip = "设置3D背景相机距离，推荐为较短尺寸的1/4" });
            dictA.Add("CamWidth", new PropertyPanelAttribute() { Label = "视角宽度", MatchKey = "a", Order = 3, ToolTip = "设置3D相机的视角宽度，推荐为最长尺寸" });
            PPDocPage.PredefinedPropertyAttributeDictionary = dictA;

            Dictionary<string, PropertyPanelAttribute> dictO = new Dictionary<string, PropertyPanelAttribute>();
            dictO.Add("OddMarginLeft", new PropertyPanelAttribute() { Label = "左边距", MatchKey = "o", Order = 0 });
            dictO.Add("OddMarginTop", new PropertyPanelAttribute() { Label = "上边距", MatchKey = "o", Order = 1 });
            dictO.Add("OddMarginRight", new PropertyPanelAttribute() { Label = "右边距", MatchKey = "o", Order = 2 });
            dictO.Add("OddRowCount", new PropertyPanelAttribute() { Label = "行数", MatchKey = "o", Order = 3 });
            dictO.Add("OddColCount", new PropertyPanelAttribute() { Label = "列数", MatchKey = "o", Order = 4 });
            dictO.Add("OddRowHeight", new PropertyPanelAttribute() { Label = "行高", MatchKey = "o", Order = 5 });
            dictO.Add("OddColWidths", new PropertyPanelAttribute() { Label = "列宽", MatchKey = "o", Order = 6 });
            PPOddNA.PredefinedPropertyAttributeDictionary = dictO;

            Dictionary<string, PropertyPanelAttribute> dictE = new Dictionary<string, PropertyPanelAttribute>();
            dictE.Add("EvenMarginLeft", new PropertyPanelAttribute() { Label = "左边距", MatchKey = "e", Order = 0 });
            dictE.Add("EvenMarginTop", new PropertyPanelAttribute() { Label = "上边距", MatchKey = "e", Order = 1 });
            dictE.Add("EvenMarginRight", new PropertyPanelAttribute() { Label = "右边距", MatchKey = "e", Order = 2 });
            dictE.Add("EvenRowCount", new PropertyPanelAttribute() { Label = "行数", MatchKey = "e", Order = 3 });
            dictE.Add("EvenColCount", new PropertyPanelAttribute() { Label = "列数", MatchKey = "e", Order = 4 });
            dictE.Add("EvenRowHeight", new PropertyPanelAttribute() { Label = "行高", MatchKey = "e", Order = 5 });
            dictE.Add("EvenColWidths", new PropertyPanelAttribute() { Label = "列宽", MatchKey = "e", Order = 6 });
            PPEvenNA.PredefinedPropertyAttributeDictionary = dictE;

            DataContext = this;
        }

        public Properties.Settings Settings { get { return Properties.Settings.Default; } }
        public ProjectViewModel CurrentShadow { get; set; }

        private void Done_Click(object sender, RoutedEventArgs e)
        {
            Settings.Save();
            Close();
        }
    }
}
